home *** CD-ROM | disk | FTP | other *** search
- unit CopyHk;
-
- interface
-
- uses
- Windows, ComObj, ComServ, SysUtils, ShlObj;
-
- Const
- CLSID_CopyHookShellExtension: TGUID = (
- D1:$8e3e0f0a; D2:$0fcc; D3:$11ce; D4:($bc, $b0, $b3, $fd, $0e, $25, $38, $19));
-
-
- type
- TCopyHook = class(TComObject, ICopyHookA)
- public
- function CopyCallback(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
- dwSrcAttribs: DWORD; pszDestFile: PAnsiChar; dwDestAttribs: DWORD): UINT; stdcall;
- end;
-
- implementation
-
- function TCopyHook.CopyCallBack(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
- dwSrcAttribs: DWORD; pszDestFile: PAnsiChar; dwDestAttribs: DWORD): UINT;
- // This is the method which is called by the shell for folder operations
- const
- MyMessage: String = 'Are you sure you want to commit this operation?';
- begin
- // confirm operation
- Result := MessageBox(Wnd, PChar(Format(MyMessage, [pszSrcFile])),
- 'Delphi 3.0 CopyHook Shell Extension ...' , MB_YESNO);
- end;
-
- initialization
- TComObjectFactory.Create(ComServer, TCopyHook, CLSID_CopyHookShellExtension,
- '', 'This is a CopyHook Sample for 3.0', ciMultiInstance);
-
- end.
-